package com.hsc.yalebao.tabMine;

import android.annotation.SuppressLint;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.text.TextPaint;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup.LayoutParams;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ListAdapter;
import android.widget.ListView;
import android.widget.TextView;
import com.google.gson.Gson;
import com.hsc.yalebao.adapter.backruleRateListAdapter;
import com.hsc.yalebao.base.ActivityStack;
import com.hsc.yalebao.base.BaseActivity;
import com.hsc.yalebao.base.CustomApplication;
import com.hsc.yalebao.base.MainActivity;
import com.hsc.yalebao.http.AppConstants;
import com.hsc.yalebao.http.RequestNet;
import com.hsc.yalebao.model.GetOauthAndReturnRuleInfoBean;
import com.hsc.yalebao.model.GetWaterRateListBaseBean;
import com.hsc.yalebao.model.GetWaterRateListModel;
import com.hsc.yalebao.model.HuiShuiListBean;
import com.hsc.yalebao.model.HuiShuiStatusBean;
import com.hsc.yalebao.tools.UiUtil;
import com.hsc.yalebao.weight.LogUtils;
import com.zhy.http.okhttp.callback.StringCallback;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import okhttp3.Call;

public class BackRuleActivity extends BaseActivity
{
  private String TAG = "BackRuleActivity";
  private backruleRateListAdapter adapter;
  private backruleRateListAdapter adapter2;
  private backruleRateListAdapter adapter3;
  private ListView chu_backrule_list;
  private LinearLayout chuji;
  private Context context;
  private HuiShuiListBean huiShuiListBean;
  private ImageView iv_title_right;
  private LinearLayout ll_back_rule;
  private LinearLayout ll_super;
  private LinearLayout ll_zhongji;
  private ListView mPullRefreshListView;
  private TextView mTiShiTv;
  View.OnClickListener onClickListener = new View.OnClickListener()
  {
    public void onClick(View paramAnonymousView)
    {
      switch (paramAnonymousView.getId())
      {
      case 2131099704:
      default:
        return;
      case 2131099699:
        CustomApplication.app.finishActivity(BackRuleActivity.this);
        return;
      case 2131099731:
      }
      BackRuleActivity.this.startActivity(new Intent(BackRuleActivity.this, AccountChangeActivity.class));
    }
  };
  private ArrayList<GetWaterRateListBaseBean> result = new ArrayList();
  private ArrayList<GetWaterRateListBaseBean> result2 = new ArrayList();
  private ArrayList<GetWaterRateListBaseBean> result3 = new ArrayList();
  private ListView super_list;
  private TextView tv_chujifang;
  private TextView tv_gaojifang;
  private TextView tv_one;
  private TextView tv_tishi;
  private TextView tv_tishi2;
  private TextView tv_two;
  private TextView tv_zhangbian;
  private TextView tv_zhongjifang;

  private void checkStatus()
  {
    Iterator localIterator = this.huiShuiListBean.getResult().iterator();
    int j;
    String str;
    while (true)
    {
      if (!localIterator.hasNext())
        return;
      HuiShuiStatusBean localHuiShuiStatusBean = (HuiShuiStatusBean)localIterator.next();
      int i = localHuiShuiStatusBean.getLevel_type();
      j = localHuiShuiStatusBean.getRule_state();
      str = localHuiShuiStatusBean.getLevel_name();
      switch (i)
      {
      default:
      case 1:
      case 2:
      case 3:
      }
    }
    if (j == 0)
      this.chuji.setVisibility(8);
    while (true)
    {
      this.tv_chujifang.setText(str + "回水比例说明：");
      break;
      this.chuji.setVisibility(0);
    }
    if (j == 0)
      this.ll_zhongji.setVisibility(8);
    while (true)
    {
      this.tv_zhongjifang.setText(str + "回水比例说明：");
      break;
      this.ll_zhongji.setVisibility(0);
    }
    if (j == 0)
      this.ll_super.setVisibility(8);
    while (true)
    {
      this.tv_gaojifang.setText(str + "回水比例说明：");
      break;
      this.ll_super.setVisibility(0);
    }
  }

  private void getStatusList()
  {
    HashMap localHashMap = new HashMap();
    LogUtils.d(this.TAG, "URL:" + AppConstants.URL_GETRETURNWATERSTATE);
    showLoadingDialog();
    RequestNet.get(this.context, AppConstants.URL_GETRETURNWATERSTATE, localHashMap, new StringCallback()
    {
      public void onError(Call paramAnonymousCall, Exception paramAnonymousException)
      {
        BackRuleActivity.this.dismissLoadingDialog();
        LogUtils.e(BackRuleActivity.this.TAG, "获取失败,获取提现记录:" + paramAnonymousException);
      }

      public void onResponse(String paramAnonymousString)
      {
        BackRuleActivity.this.dismissLoadingDialog();
        LogUtils.d(BackRuleActivity.this.TAG, "result:" + paramAnonymousString);
        if (UiUtil.IsValueEmpty(paramAnonymousString))
          LogUtils.d(BackRuleActivity.this.TAG, "result:" + paramAnonymousString);
        do
        {
          return;
          Gson localGson = new Gson();
          try
          {
            BackRuleActivity.this.huiShuiListBean = ((HuiShuiListBean)localGson.fromJson(paramAnonymousString, HuiShuiListBean.class));
            if (BackRuleActivity.this.huiShuiListBean == null)
            {
              LogUtils.e(BackRuleActivity.this.TAG, "获取失败");
              return;
            }
          }
          catch (Exception localException)
          {
            while (true)
            {
              BackRuleActivity.this.huiShuiListBean = null;
              localException.printStackTrace();
            }
            if (BackRuleActivity.this.huiShuiListBean.getFlag() == 0)
            {
              LogUtils.e(BackRuleActivity.this.TAG, "returnwaterResultModel.getFlag() != 1,0,-2");
              return;
            }
            if (BackRuleActivity.this.huiShuiListBean.getFlag() == -2)
            {
              BackRuleActivity.this.showDownWireDialog();
              return;
            }
            if (BackRuleActivity.this.huiShuiListBean.getFlag() == -3)
            {
              BackRuleActivity.this.ShowFengjinDialog();
              return;
            }
            if (BackRuleActivity.this.huiShuiListBean.getFlag() == -4)
            {
              BackRuleActivity.activityStack.backToMain(MainActivity.class, BackRuleActivity.this.context);
              return;
            }
          }
        }
        while (BackRuleActivity.this.huiShuiListBean.getFlag() != 1);
        if (BackRuleActivity.this.huiShuiListBean.getResult() == null)
        {
          LogUtils.e(BackRuleActivity.this.TAG, "bean.getResult() == null");
          return;
        }
        BackRuleActivity.this.checkStatus();
      }
    });
  }

  private void getVipListProfitList()
  {
    HashMap localHashMap = new HashMap();
    localHashMap.put("type", "2");
    LogUtils.d(this.TAG, "URL:" + AppConstants.URL_GET_GETWATERRATELIST);
    showLoadingDialog();
    RequestNet.get(this.context, AppConstants.URL_GET_GETWATERRATELIST, localHashMap, new StringCallback()
    {
      public void onError(Call paramAnonymousCall, Exception paramAnonymousException)
      {
        BackRuleActivity.this.dismissLoadingDialog();
        LogUtils.e(BackRuleActivity.this.TAG, "获取失败,获取中高级:" + paramAnonymousException);
      }

      public void onResponse(String paramAnonymousString)
      {
        BackRuleActivity.this.dismissLoadingDialog();
        LogUtils.d(BackRuleActivity.this.TAG, "result:" + paramAnonymousString);
        if (UiUtil.IsValueEmpty(paramAnonymousString))
          LogUtils.d(BackRuleActivity.this.TAG, "result:" + paramAnonymousString);
        GetWaterRateListModel localGetWaterRateListModel;
        do
        {
          return;
          Gson localGson = new Gson();
          try
          {
            localGetWaterRateListModel = (GetWaterRateListModel)localGson.fromJson(paramAnonymousString, GetWaterRateListModel.class);
            if (localGetWaterRateListModel == null)
            {
              LogUtils.e(BackRuleActivity.this.TAG, "获取失败");
              return;
            }
          }
          catch (Exception localException)
          {
            while (true)
            {
              localException.printStackTrace();
              localGetWaterRateListModel = null;
            }
            if (localGetWaterRateListModel.getFlag() == 0)
            {
              LogUtils.e(BackRuleActivity.this.TAG, "returnwaterResultModel.getFlag() != 1,0,-2");
              return;
            }
            if (localGetWaterRateListModel.getFlag() == -2)
            {
              BackRuleActivity.this.showDownWireDialog();
              return;
            }
            if (localGetWaterRateListModel.getFlag() == -3)
            {
              BackRuleActivity.this.ShowFengjinDialog();
              return;
            }
            if (localGetWaterRateListModel.getFlag() == -4)
            {
              BackRuleActivity.activityStack.backToMain(MainActivity.class, BackRuleActivity.this.context);
              return;
            }
          }
        }
        while (localGetWaterRateListModel.getFlag() != 1);
        if (localGetWaterRateListModel.getResult() == null)
        {
          LogUtils.e(BackRuleActivity.this.TAG, "bean.getResult() == null");
          return;
        }
        BackRuleActivity.this.result.addAll(localGetWaterRateListModel.getResult());
        if ((BackRuleActivity.this.result == null) || (BackRuleActivity.this.result.size() == 0))
          BackRuleActivity.this.tv_tishi2.setText("暂无数据");
        BackRuleActivity.this.adapter.setData(BackRuleActivity.this.result);
        BackRuleActivity.this.adapter.notifyDataSetChanged();
        BackRuleActivity.setListViewHeightBasedOnChildren(BackRuleActivity.this.mPullRefreshListView);
      }
    });
  }

  private void getVipListProfitListchu()
  {
    HashMap localHashMap = new HashMap();
    localHashMap.put("type", "3");
    LogUtils.d(this.TAG, "URL:" + AppConstants.URL_GET_GETWATERRATELIST);
    showLoadingDialog();
    RequestNet.get(this.context, AppConstants.URL_GET_GETWATERRATELIST, localHashMap, new StringCallback()
    {
      public void onError(Call paramAnonymousCall, Exception paramAnonymousException)
      {
        BackRuleActivity.this.dismissLoadingDialog();
        LogUtils.e(BackRuleActivity.this.TAG, "获取失败,获取初级房:" + paramAnonymousException);
      }

      public void onResponse(String paramAnonymousString)
      {
        BackRuleActivity.this.dismissLoadingDialog();
        LogUtils.d(BackRuleActivity.this.TAG, "result2:" + paramAnonymousString);
        if (UiUtil.IsValueEmpty(paramAnonymousString))
          LogUtils.d(BackRuleActivity.this.TAG, "result2:" + paramAnonymousString);
        GetWaterRateListModel localGetWaterRateListModel;
        do
        {
          return;
          Gson localGson = new Gson();
          try
          {
            localGetWaterRateListModel = (GetWaterRateListModel)localGson.fromJson(paramAnonymousString, GetWaterRateListModel.class);
            if (localGetWaterRateListModel == null)
            {
              LogUtils.e(BackRuleActivity.this.TAG, "获取失败");
              return;
            }
          }
          catch (Exception localException)
          {
            while (true)
            {
              localException.printStackTrace();
              localGetWaterRateListModel = null;
            }
            if (localGetWaterRateListModel.getFlag() == 0)
            {
              LogUtils.e(BackRuleActivity.this.TAG, "returnwaterResultModel.getFlag() != 1,0,-2");
              return;
            }
            if (localGetWaterRateListModel.getFlag() == -2)
            {
              BackRuleActivity.this.showDownWireDialog();
              return;
            }
            if (localGetWaterRateListModel.getFlag() == -3)
            {
              BackRuleActivity.this.ShowFengjinDialog();
              return;
            }
            if (localGetWaterRateListModel.getFlag() == -4)
            {
              BackRuleActivity.activityStack.backToMain(MainActivity.class, BackRuleActivity.this.context);
              return;
            }
          }
        }
        while (localGetWaterRateListModel.getFlag() != 1);
        if (localGetWaterRateListModel.getResult() == null)
        {
          LogUtils.e(BackRuleActivity.this.TAG, "bean.getResult() == null");
          return;
        }
        BackRuleActivity.this.result2.addAll(localGetWaterRateListModel.getResult());
        if ((BackRuleActivity.this.result2 == null) || (BackRuleActivity.this.result2.size() == 0))
          BackRuleActivity.this.tv_tishi.setText("暂无数据");
        BackRuleActivity.this.adapter2.setData(BackRuleActivity.this.result2);
        BackRuleActivity.this.adapter2.notifyDataSetChanged();
        BackRuleActivity.setListViewHeightBasedOnChildren(BackRuleActivity.this.chu_backrule_list);
      }
    });
  }

  private void getoauthandreturnruleinfo()
  {
    HashMap localHashMap = new HashMap();
    LogUtils.d(this.TAG, "URL:" + AppConstants.URL_GETOAUTHANDRETURNRULEINFO);
    showLoadingDialog();
    RequestNet.get(this.context, AppConstants.URL_GETOAUTHANDRETURNRULEINFO, localHashMap, new StringCallback()
    {
      public void onError(Call paramAnonymousCall, Exception paramAnonymousException)
      {
        BackRuleActivity.this.dismissLoadingDialog();
      }

      public void onResponse(String paramAnonymousString)
      {
        BackRuleActivity.this.dismissLoadingDialog();
        LogUtils.d(BackRuleActivity.this.TAG, "getoauthandreturnruleinfo   result:" + paramAnonymousString);
        if (UiUtil.IsValueEmpty(paramAnonymousString))
          LogUtils.d(BackRuleActivity.this.TAG, "getoauthandreturnruleinfo result:" + paramAnonymousString);
        while (true)
        {
          return;
          Gson localGson = new Gson();
          GetOauthAndReturnRuleInfoBean localGetOauthAndReturnRuleInfoBean;
          try
          {
            localGetOauthAndReturnRuleInfoBean = (GetOauthAndReturnRuleInfoBean)localGson.fromJson(paramAnonymousString, GetOauthAndReturnRuleInfoBean.class);
            if (localGetOauthAndReturnRuleInfoBean == null)
            {
              LogUtils.e(BackRuleActivity.this.TAG, "获取失败");
              return;
            }
          }
          catch (Exception localException1)
          {
            while (true)
            {
              localException1.printStackTrace();
              localGetOauthAndReturnRuleInfoBean = null;
            }
          }
          if (localGetOauthAndReturnRuleInfoBean.getFlag() != 0)
          {
            if (localGetOauthAndReturnRuleInfoBean.getFlag() == -2)
            {
              BackRuleActivity.this.showDownWireDialog();
              return;
            }
            if (localGetOauthAndReturnRuleInfoBean.getFlag() == -3)
            {
              BackRuleActivity.this.ShowFengjinDialog();
              return;
            }
            if (localGetOauthAndReturnRuleInfoBean.getFlag() == -4)
            {
              BackRuleActivity.activityStack.backToMain(MainActivity.class, BackRuleActivity.this.context);
              return;
            }
            if (localGetOauthAndReturnRuleInfoBean.getFlag() == 1)
            {
              BackRuleActivity.this.ll_back_rule.setVisibility(0);
              BackRuleActivity.this.mTiShiTv.setVisibility(8);
              String str1 = localGetOauthAndReturnRuleInfoBean.getReturn_water_num();
              if (!"".equals(str1))
                BackRuleActivity.this.tv_one.setText("①当天下注满  " + str1 + " 期;");
              String str2 = localGetOauthAndReturnRuleInfoBean.getReturn_water_combine_rate();
              try
              {
                BigDecimal localBigDecimal = new BigDecimal(Double.valueOf(str2).doubleValue()).multiply(new BigDecimal(1)).setScale(0, 4);
                if (!"".equals(str2))
                {
                  BackRuleActivity.this.tv_two.setText("②组合比例不低于" + localBigDecimal + "%;");
                  return;
                }
              }
              catch (Exception localException2)
              {
                localException2.printStackTrace();
              }
            }
          }
        }
      }
    });
  }

  private void getsuper()
  {
    HashMap localHashMap = new HashMap();
    localHashMap.put("type", "4");
    LogUtils.d(this.TAG, "URL:" + AppConstants.URL_GET_GETWATERRATELIST);
    showLoadingDialog();
    RequestNet.get(this.context, AppConstants.URL_GET_GETWATERRATELIST, localHashMap, new StringCallback()
    {
      public void onError(Call paramAnonymousCall, Exception paramAnonymousException)
      {
        BackRuleActivity.this.dismissLoadingDialog();
        LogUtils.e(BackRuleActivity.this.TAG, "获取失败,获取初级房:" + paramAnonymousException);
        BackRuleActivity.setListViewHeightBasedOnChildren(BackRuleActivity.this.super_list);
      }

      public void onResponse(String paramAnonymousString)
      {
        BackRuleActivity.this.dismissLoadingDialog();
        LogUtils.d(BackRuleActivity.this.TAG, "result3:" + paramAnonymousString);
        if (UiUtil.IsValueEmpty(paramAnonymousString))
          LogUtils.d(BackRuleActivity.this.TAG, "result3:" + paramAnonymousString);
        GetWaterRateListModel localGetWaterRateListModel;
        do
        {
          return;
          Gson localGson = new Gson();
          try
          {
            localGetWaterRateListModel = (GetWaterRateListModel)localGson.fromJson(paramAnonymousString, GetWaterRateListModel.class);
            if (localGetWaterRateListModel == null)
            {
              LogUtils.e(BackRuleActivity.this.TAG, "获取失败");
              return;
            }
          }
          catch (Exception localException)
          {
            while (true)
            {
              localException.printStackTrace();
              localGetWaterRateListModel = null;
            }
            if (localGetWaterRateListModel.getFlag() == 0)
            {
              LogUtils.e(BackRuleActivity.this.TAG, "returnwaterResultModel.getFlag() != 1,0,-2");
              return;
            }
            if (localGetWaterRateListModel.getFlag() == -2)
            {
              BackRuleActivity.this.showDownWireDialog();
              return;
            }
            if (localGetWaterRateListModel.getFlag() == -3)
            {
              BackRuleActivity.this.ShowFengjinDialog();
              return;
            }
            if (localGetWaterRateListModel.getFlag() == -4)
            {
              BackRuleActivity.activityStack.backToMain(MainActivity.class, BackRuleActivity.this.context);
              return;
            }
          }
        }
        while (localGetWaterRateListModel.getFlag() != 1);
        if (localGetWaterRateListModel.getResult() == null)
        {
          LogUtils.e(BackRuleActivity.this.TAG, "bean.getResult() == null");
          return;
        }
        BackRuleActivity.this.result3.addAll(localGetWaterRateListModel.getResult());
        if (BackRuleActivity.this.result3 != null)
          BackRuleActivity.this.result3.size();
        BackRuleActivity.this.adapter3.setData(BackRuleActivity.this.result3);
        BackRuleActivity.this.adapter3.notifyDataSetChanged();
        BackRuleActivity.setListViewHeightBasedOnChildren(BackRuleActivity.this.super_list);
      }
    });
  }

  private void init()
  {
    Bundle localBundle = getIntent().getExtras();
    if (localBundle != null)
      this.huiShuiListBean = ((HuiShuiListBean)localBundle.getSerializable("bean"));
    this.mPullRefreshListView = ((ListView)findViewById(2131099723));
    this.chu_backrule_list = ((ListView)findViewById(2131099720));
    this.super_list = ((ListView)findViewById(2131099726));
    this.tv_chujifang = ((TextView)findViewById(2131099719));
    this.tv_zhongjifang = ((TextView)findViewById(2131099722));
    this.tv_gaojifang = ((TextView)findViewById(2131099725));
    this.chuji = ((LinearLayout)findViewById(2131099718));
    this.ll_zhongji = ((LinearLayout)findViewById(2131099721));
    this.ll_super = ((LinearLayout)findViewById(2131099724));
    if (this.adapter == null)
    {
      this.adapter = new backruleRateListAdapter(this.context, this.result);
      this.mPullRefreshListView.setAdapter(this.adapter);
    }
    if (this.adapter2 == null)
    {
      this.adapter2 = new backruleRateListAdapter(this.context, this.result2);
      this.chu_backrule_list.setAdapter(this.adapter2);
    }
    if (this.adapter3 == null)
    {
      this.adapter3 = new backruleRateListAdapter(this.context, this.result3);
      this.super_list.setAdapter(this.adapter3);
    }
    this.adapter.notifyDataSetChanged();
    this.adapter2.notifyDataSetChanged();
    this.adapter3.notifyDataSetChanged();
    if (this.huiShuiListBean == null)
    {
      getStatusList();
      return;
    }
    checkStatus();
  }

  public static void setListViewHeightBasedOnChildren(ListView paramListView)
  {
    ListAdapter localListAdapter = paramListView.getAdapter();
    if (localListAdapter == null)
      return;
    int i = 0;
    for (int j = 0; ; j++)
    {
      if (j >= localListAdapter.getCount())
      {
        ViewGroup.LayoutParams localLayoutParams = paramListView.getLayoutParams();
        localLayoutParams.height = (i + paramListView.getDividerHeight() * (-1 + localListAdapter.getCount()));
        paramListView.setLayoutParams(localLayoutParams);
        return;
      }
      View localView = localListAdapter.getView(j, null, paramListView);
      localView.measure(0, 0);
      i += localView.getMeasuredHeight();
    }
  }

  protected void onCreate(Bundle paramBundle)
  {
    super.onCreate(paramBundle);
    setContentView(2130903042);
    CustomApplication.app.addActivity(this);
    this.context = this;
    setTitle(8, 0, 2130837809, "回水规则", 0, 8, 8, 0, true);
    this.tv_zhangbian = ((TextView)findViewById(2131099731));
    this.tv_one = ((TextView)findViewById(2131099728));
    this.tv_two = ((TextView)findViewById(2131099729));
    this.ll_back_rule = ((LinearLayout)findViewById(2131099727));
    this.tv_zhangbian.getPaint().setFlags(8);
    this.tv_zhangbian.setOnClickListener(this.onClickListener);
    this.mTiShiTv = ((TextView)findViewById(2131099732));
    this.ll_back_rule.setVisibility(8);
    this.mTiShiTv.setVisibility(0);
    init();
    getoauthandreturnruleinfo();
    getVipListProfitList();
    getVipListProfitListchu();
    getsuper();
  }

  @SuppressLint({"NewApi"})
  public void setTitle(int paramInt1, int paramInt2, int paramInt3, String paramString, int paramInt4, int paramInt5, int paramInt6, int paramInt7, boolean paramBoolean)
  {
    View localView = findViewById(2131099716);
    if (paramBoolean)
      localView.setVisibility(0);
    while (true)
    {
      ((TextView)localView.findViewById(2131099701)).setText(paramString);
      ((TextView)localView.findViewById(2131099700)).setVisibility(paramInt1);
      ImageView localImageView = (ImageView)localView.findViewById(2131099699);
      localImageView.setVisibility(paramInt2);
      localImageView.setOnClickListener(this.onClickListener);
      localImageView.setImageResource(paramInt3);
      TextView localTextView = (TextView)localView.findViewById(2131099702);
      localTextView.setVisibility(paramInt5);
      localTextView.setOnClickListener(this.onClickListener);
      this.iv_title_right = ((ImageView)localView.findViewById(2131099704));
      this.iv_title_right.setVisibility(paramInt6);
      this.iv_title_right.setOnClickListener(this.onClickListener);
      this.iv_title_right.setImageResource(paramInt7);
      return;
      localView.setVisibility(8);
    }
  }
}

/* Location:           C:\Users\user\Desktop\dd28_pcdd720\classes_dex2jar.jar
 * Qualified Name:     com.hsc.yalebao.tabMine.BackRuleActivity
 * JD-Core Version:    0.6.2
 */